package com.tenebrous.jestic.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Description:
 * @Project: jestic-server
 * @Package: com.tenebrous.jestic.enums
 * @Author: zhangya
 * @CreateTime: 2023-06-29  14:04
 * @Version: 1.0.0
 */
public enum TaskEnum {

    AUTHORITY("authority", "授权认证"),
    HEART_BEAT("heartBeat", "心跳检测"),

    DECRYPT("decrypt", "解密"),

    ENCRYPT("encrypt", "加密");

    private String code;

    private String desc;

    TaskEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static TaskEnum getInstance(String code) {
        return Arrays.stream(TaskEnum.values()).filter(s -> s.getCode().equals(code)).findFirst().orElse(null);
    }
}
